Optimal. Leaf size=91 \[ \frac {1}{2} a \left (a^2+3 b^2\right ) x-\frac {b^3 \log (\sin (c+d x))}{d}+\frac {b^3 \log (\tan (c+d x))}{d}+\frac {\left (b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 91, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3167, 1819,
815, 649, 209, 266} \begin {gather*} \frac {\sin ^2(c+d x) \left (a \left (a^2-3 b^2\right ) \cot (c+d x)+b \left (3 a^2-b^2\right )\right )}{2 d}+\frac {1}{2} a x \left (a^2+3 b^2\right )-\frac {b^3 \log (\sin (c+d x))}{d}+\frac {b^3 \log (\tan (c+d x))}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 266
Rule 649
Rule 815
Rule 1819
Rule 3167
Rubi steps
\begin {align*} \int \sec (c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx &=-\frac {\text {Subst}\left (\int \frac {(b+a x)^3}{x \left (1+x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{d}\\ &=\frac {\left (b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\text {Subst}\left (\int \frac {-2 b^3-a \left (a^2+3 b^2\right ) x}{x \left (1+x^2\right )} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {\left (b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\text {Subst}\left (\int \left (-\frac {2 b^3}{x}+\frac {-a^3-3 a b^2+2 b^3 x}{1+x^2}\right ) \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {b^3 \log (\tan (c+d x))}{d}+\frac {\left (b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {\text {Subst}\left (\int \frac {-a^3-3 a b^2+2 b^3 x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {b^3 \log (\tan (c+d x))}{d}+\frac {\left (b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^3 \text {Subst}\left (\int \frac {x}{1+x^2} \, dx,x,\cot (c+d x)\right )}{d}-\frac {\left (a \left (a^2+3 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}\\ &=\frac {1}{2} a \left (a^2+3 b^2\right ) x-\frac {b^3 \log (\sin (c+d x))}{d}+\frac {b^3 \log (\tan (c+d x))}{d}+\frac {\left (b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(401\) vs. \(2(91)=182\).
time = 0.84, size = 401, normalized size = 4.41 \begin {gather*} \frac {5 a^4 b^2+2 a^2 b^4-b^6+\left (-3 a^4 b^2-2 a^2 b^4+b^6\right ) \cos (2 (c+d x))+2 a^2 b^4 \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+2 b^6 \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-a^5 \sqrt {-b^2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+4 a^3 \left (-b^2\right )^{3/2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-3 a \left (-b^2\right )^{5/2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+2 a^2 b^4 \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+2 b^6 \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+a^5 \sqrt {-b^2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+3 a b^4 \sqrt {-b^2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )-4 a^3 \left (-b^2\right )^{3/2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+a b \left (a^4-2 a^2 b^2-3 b^4\right ) \sin (2 (c+d x))}{4 b \left (a^2+b^2\right ) d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.24, size = 98, normalized size = 1.08
method | result | size |
derivativedivides | \(\frac {a^{3} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 a^{2} \left (\cos ^{2}\left (d x +c \right )\right ) b}{2}+3 a \,b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) | \(98\) |
default | \(\frac {a^{3} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 a^{2} \left (\cos ^{2}\left (d x +c \right )\right ) b}{2}+3 a \,b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) | \(98\) |
risch | \(i x \,b^{3}+\frac {a^{3} x}{2}+\frac {3 a \,b^{2} x}{2}-\frac {3 \,{\mathrm e}^{2 i \left (d x +c \right )} a^{2} b}{8 d}+\frac {{\mathrm e}^{2 i \left (d x +c \right )} b^{3}}{8 d}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} a^{3}}{8 d}+\frac {3 i {\mathrm e}^{2 i \left (d x +c \right )} a \,b^{2}}{8 d}-\frac {3 \,{\mathrm e}^{-2 i \left (d x +c \right )} a^{2} b}{8 d}+\frac {{\mathrm e}^{-2 i \left (d x +c \right )} b^{3}}{8 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} a^{3}}{8 d}-\frac {3 i {\mathrm e}^{-2 i \left (d x +c \right )} a \,b^{2}}{8 d}+\frac {2 i b^{3} c}{d}-\frac {b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(196\) |
norman | \(\frac {\left (\frac {1}{2} a^{3}+\frac {3}{2} a \,b^{2}\right ) x +\left (\frac {1}{2} a^{3}+\frac {3}{2} a \,b^{2}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{2} a^{3}+\frac {9}{2} a \,b^{2}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{2} a^{3}+\frac {9}{2} a \,b^{2}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (6 a^{2} b -2 b^{3}\right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (6 a^{2} b -2 b^{3}\right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a \left (a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {a \left (a^{2}-3 b^{2}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}+\frac {b^{3} \ln \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}-\frac {b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) | \(272\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 91, normalized size = 1.00 \begin {gather*} \frac {6 \, a^{2} b \sin \left (d x + c\right )^{2} + {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{3} + 3 \, {\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a b^{2} - 2 \, {\left (\sin \left (d x + c\right )^{2} + \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )} b^{3}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.35, size = 79, normalized size = 0.87 \begin {gather*} -\frac {2 \, b^{3} \log \left (-\cos \left (d x + c\right )\right ) - {\left (a^{3} + 3 \, a b^{2}\right )} d x + {\left (3 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right )^{2} - {\left (a^{3} - 3 \, a b^{2}\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a \cos {\left (c + d x \right )} + b \sin {\left (c + d x \right )}\right )^{3} \sec {\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.50, size = 93, normalized size = 1.02 \begin {gather*} \frac {b^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + {\left (a^{3} + 3 \, a b^{2}\right )} {\left (d x + c\right )} - \frac {b^{3} \tan \left (d x + c\right )^{2} - a^{3} \tan \left (d x + c\right ) + 3 \, a b^{2} \tan \left (d x + c\right ) + 3 \, a^{2} b}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.24, size = 156, normalized size = 1.71 \begin {gather*} \frac {b^3\,\ln \left (\frac {1}{{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}\right )-b^3\,\ln \left (\frac {\cos \left (c+d\,x\right )}{\cos \left (c+d\,x\right )+1}\right )+a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+\frac {b^3\,\cos \left (2\,c+2\,d\,x\right )}{4}+\frac {a^3\,\sin \left (2\,c+2\,d\,x\right )}{4}+3\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-\frac {3\,a^2\,b\,\cos \left (2\,c+2\,d\,x\right )}{4}-\frac {3\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________